home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / tess / tess-1.0 / pmg.m < prev    next >
Encoding:
Text File  |  1992-06-30  |  1.0 KB  |  48 lines

  1. #import "aGroup-inter.h"
  2. #import "aGroup.h"
  3. #import "pmg.h"
  4.  
  5. @implementation pmg
  6. - resizeGenerator
  7. {
  8.   latticesize.height = 4.0* bounds.size.height;
  9.   latticesize.width = bounds.size.width;
  10.   upx = 0;
  11.   upy = latticesize.height;
  12.   overx = latticesize.width;
  13.   gravy = upy/2;
  14.   gravx = (upx+overx)/2;
  15.   return self;
  16. }
  17.  
  18. - makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
  19. {
  20.   id imgrep;
  21.   NXPoint pt;
  22.   
  23.   pt.x = - point->x ;
  24.   pt.y = - point->y ;
  25.   imgrep = [srcimg bestRepresentation];
  26.   PSgsave(); // bottom
  27.   [self clip:0.0:0.0];[imgrep drawAt: &pt];
  28.   PSgrestore();
  29.   PSgsave(); // bottom middle
  30.   reflect(0.0);
  31.   PStranslate(0,-2*bounds.size.height);
  32.   [self clip:0.0:0.0]; [imgrep drawAt: &pt];
  33.   PSgrestore();
  34.   PSgsave(); // top top
  35.   PSrotate(180);
  36.   PStranslate(-overx,-upy);
  37.   [self clip:0.0:0.0]; [imgrep drawAt: &pt];
  38.   PSgrestore();
  39.   PSgsave();// top mid
  40.   reflect(0.0);
  41.   PSrotate(180);
  42.   PStranslate(-bounds.size.width,2*bounds.size.height);
  43.   [self clip:0.0:0.0]; [imgrep drawAt: &pt];
  44.   PSgrestore();
  45.   return self;
  46. }
  47. @end
  48.